/*
 * @Author: songdengwei
 * @Date: 2021-09-14 16:22:16
 * @LastEditors: songdengwei
 * @LastEditTime: 2020-07-21
 * @Description:
 */

(function () {
  function setRootFontSize() {
    let rem, rootWidth;
    let rootHtml = document.documentElement;
    //限制展现页面的最小宽度
    rootWidth = rootHtml.clientWidth > 1920 ? 1920 : rootHtml.clientWidth;
    // 19.2 = 设计图尺寸宽 / 100（ 设计图的rem = 100 ）
    rem = rootWidth / 19.2;

    // 动态写入样式
    rootHtml.style.fontSize = `${rem}px`;
  }
  setRootFontSize();
  window.addEventListener("resize", setRootFontSize, true);
})();
